package com.shop.controller;


import com.shop.entity.MerchantGoods;
import com.shop.model.vo.Rsp;
import com.shop.service.MerchantMerchantService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * (MerchantMerchant)表控制层
 *
 * @author makejava
 * @since 2020-11-22 16:15:18
 */
@Validated
@RestController
@RequestMapping("merchant")
@AllArgsConstructor
public class MerchantController {
    /**
     * 服务对象
     */
    private final MerchantMerchantService merchantMerchantService;



    @GetMapping("/getByCity")
    public Rsp getByCity(Double latitude,Double longitude,String city){
        System.out.println(city);
        return merchantMerchantService.getByCity(latitude,longitude,city);
    }

    /**
     * 根据评分排序
     * @return
     */
    @GetMapping("/getMerchantSortByScore")
    public Rsp getMerchantSortByScore(){
        return merchantMerchantService.getMerchantSortByScore();
    }

    /**
     * 根据距离排序
     * @param latitude
     * @param longitude
     * @return
     */
    @GetMapping("/getMerchantSortByDistance")
    public Rsp getMerchantSortByDistance(Double latitude, Double longitude){
        return merchantMerchantService.getMerchantSortByDistance(latitude,longitude);
    }

    /**
     * 根据销量升序
     * @return
     */
    @GetMapping("/getMerchantBySalesUp")
    public Rsp getMerchantBySalesUp(){
        return merchantMerchantService.getMerchantBySalesUp();
    }

    /**
     * 根据销量降序
     * @return
     */
    @GetMapping("/getMerchantBySalesDown")
    public Rsp getMerchantBySalesDown(){
        return merchantMerchantService.getMerchantBySalesDown();
    }

    /**
     * 根据速度升序
     * @return
     */
    @GetMapping("/getMerchantBySpeedUp")
    public Rsp getMerchantBySpeedUp(){
        return merchantMerchantService.getMerchantBySpeedUp();
    }

    /**
     * 根据速度降序
     * @return
     */
    @GetMapping("/getMerchantBySpeedDown")
    public Rsp getMerchantBySpeedDown(){
        return merchantMerchantService.getMerchantBySpeedDown();
    }

    @GetMapping("/getMerchantByReachPriceDown")
    public Rsp getMerchantBySpeedReachPriceDown(){
        return merchantMerchantService.getMerchantByReachPriceDown();
    }


    @GetMapping("/getMerchantByReachPriceUp")
    public Rsp getMerchantByReachPriceUp(){
        return merchantMerchantService.getMerchantByReachPriceUp();
    }




    @GetMapping("getMerchantById")
    public Rsp getMerchantById(@NotNull Integer id){
        return merchantMerchantService.getMerchantById(id);
    }



}
